package advance_1;

public class StrTest {
    public static void main(String[] args) {
        String s1="abc";
        String s2="abc";
        System.out.println(s1==s2);
        String s3=s1;
        s1=s1+"java";
        System.out.println(s3);
        byte []b={65,66,67};
        String s4=new String(b);
        System.out.println(s4);
        System.out.println(">>>>>>>>>>>>>>>>>>>>");
        //charAt,indexOf,getBytes(),toCharArray()
        String s5="我喜欢java";
        //indexOf:
        int pos=s5.indexOf("c#");
        System.out.println("C#在不在?"+pos);
        pos=s5.indexOf("java");
        System.out.println("java 在不在?"+pos);
        byte[]bb=s5.getBytes();
        for(byte b1:bb){
            System.out.print(b1+" ");
        }
        System.out.println();
        char cr[]=s5.toCharArray();
        for(char c1:cr){
            System.out.print((int)c1+"="+c1+" ");
        }
        System.out.println("长度:"+s5.length());
        //substring:截取一部分字符...
        String s6=s5.substring(2,5);//含头不含尾
        System.out.println(s6);
        s5=s5.toUpperCase();
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>....");
        System.out.println(s5);
    }
}
